<?php
include("connection/connection.php");
$typeScheme=$_POST['typeScheme'];
$frm=$_POST['frmId'];
if(isset($_POST['delete']))
{
$asset_id=$_POST['asset_id'];
$loc_id=$_POST['loc_id'];
$qr="delete from tbl_dtls_q1_asset where id='$asset_id'";
$res=mysql_query($qr);
if($res)
{
$update_query="update tbl_dtls_q1_main set sub_total=(sub_total-1) where id='$loc_id'";
$res=mysql_query($update_query);

////////////////////////code for maintaining user history///////////////////
	if($typeScheme=="P&T" || $typeScheme=="TSS(P&T)")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','11','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Piped")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','37','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	if($typeScheme=="Sanitary Diggs")
	{
		$qryHistory="insert into tbl_new_user_history(user_id,form_id,action_id,ip_address,modify_date,user_type,user_name) values('$_POST[loginId]','$frm','63','$_SERVER[REMOTE_ADDR]',NOW(),'$_POST[userType]','$_POST[name]')";
	}
	
	
	mysql_query($qryHistory);
	///////////////////////////////
	
header("location:q1.php");
}
}		
?>